home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / x / volume7 / sm / patch1 < prev    next >
Encoding:
Internet Message Format  |  1990-06-01  |  24.3 KB

  1. Path: uunet!aplcen!haven!decuac!decwrl!shelby!riacs!agate!bionet!ames!sun-barr!newstop!sun!maui.fx.com
  2. From: mikew@maui.fx.com (Mike Wexler)
  3. Newsgroups: comp.sources.x
  4. Subject: v07i086: sm - a session manager, Patch1, Part01/01
  5. Message-ID: <136541@sun.Eng.Sun.COM>
  6. Date: 1 Jun 90 22:22:45 GMT
  7. Sender: news@sun.Eng.Sun.COM
  8. Lines: 819
  9. Approved: argv@sun.com
  10.  
  11. Submitted-by: mikew@maui.fx.com (Mike Wexler)
  12. Posting-number: Volume 7, Issue 86
  13. Archive-name: sm/patch1
  14. Patch-To: sm: Volume 7, Issue 78, 79
  15.  
  16. Here is the first patch to the version of SM that I just posted to
  17. comp.sources.x here are the highlights:
  18. 1. Fixed bug where pressing Save State while the state was being saved 
  19.    caused a core dump. 
  20. 2. Fixed several incompatibilities with ANSI C.
  21. 3. Ported to SGI.
  22. 4. Changed confirmation stuff to a dialog widget.
  23. 5. Added fallback resources so when the resource file can't be found, the
  24.    problem is more obvious.
  25. 6. Changed the confirmPopup from a vendorShell to a transientShell.
  26. 7. Added a strdup function for those systems that don't have one.
  27.  
  28. After you apply the patch, you should delete these files, PropUtils.h 
  29. and xdefs.h.
  30.  
  31. *** R4+/PatchLevel.h    Fri Jun  1 12:38:13 1990
  32. --- ./PatchLevel.h    Fri Jun  1 13:05:07 1990
  33. ***************
  34. *** 24,28 ****
  35.   
  36.   ******************************************************************/
  37.   
  38. ! #define PATCHLEVEL 4
  39.   #define VERSION 4.0
  40. --- 24,28 ----
  41.   
  42.   ******************************************************************/
  43.   
  44. ! #define PATCHLEVEL 5
  45.   #define VERSION 4.0
  46. *** R4+/Actions.c    Fri Jun  1 12:38:24 1990
  47. --- ./Actions.c    Fri Jun  1 12:45:18 1990
  48. ***************
  49. *** 1,6 ****
  50.   /***********************************************************
  51.   
  52. ! $Header: Actions.c,v 1.1 90/04/16 15:55:02 mikew Exp $
  53.   
  54.   Copyright 1989 by Mike Wexler, Santa Clara, Ca.
  55.   
  56. --- 1,6 ----
  57.   /***********************************************************
  58.   
  59. ! $Header: Actions.c,v 1.2 90/05/25 11:42:35 mikew Exp $
  60.   
  61.   Copyright 1989 by Mike Wexler, Santa Clara, Ca.
  62.   
  63. ***************
  64. *** 85,96 ****
  65.   String       *params;    /* params from the translation table */
  66.   Cardinal   *numParams;    /* the number of params */
  67.   {
  68. !     State        state;
  69.   
  70.       StateInit(&state);
  71.       if (StateGet(&state, XtDisplay(homeForm)) >= 0)
  72.       (void) StateSave(&state);
  73.       StateCleanup(&state);
  74.   }
  75.   
  76.   /* ARGSUSED */
  77. --- 85,102 ----
  78.   String       *params;    /* params from the translation table */
  79.   Cardinal   *numParams;    /* the number of params */
  80.   {
  81. !     State       state;
  82. !     static Bool    inProcess = False;
  83.   
  84. +     if (inProcess)
  85. +     return;
  86. +     inProcess = True;
  87.       StateInit(&state);
  88.       if (StateGet(&state, XtDisplay(homeForm)) >= 0)
  89.       (void) StateSave(&state);
  90.       StateCleanup(&state);
  91. +     inProcess = False;
  92. +     return;
  93.   }
  94.   
  95.   /* ARGSUSED */
  96. *** R4+/ICC.h    Fri Jun  1 12:38:12 1990
  97. --- ./ICC.h    Fri Jun  1 12:46:08 1990
  98. ***************
  99. *** 1,6 ****
  100.   /***********************************************************
  101.   
  102. ! $Header: ICC.h,v 3.0 89/11/20 09:24:42 mikew Exp $
  103.   
  104.   Copyright 1989 by Mike Wexler, Santa Clara, Ca.
  105.   
  106. --- 1,6 ----
  107.   /***********************************************************
  108.   
  109. ! $Header: ICC.h,v 3.1 90/06/01 12:48:35 mikew Exp $
  110.   
  111.   Copyright 1989 by Mike Wexler, Santa Clara, Ca.
  112.   
  113. ***************
  114. *** 29,32 ****
  115.       Window          icon;
  116.   }               WM_STATE;
  117.   
  118. - #define WithdrawnState 0
  119. --- 29,31 ----
  120. *** R4+/ICCUtils.c    Fri Jun  1 12:38:12 1990
  121. --- ./ICCUtils.c    Wed May 30 10:39:12 1990
  122. ***************
  123. *** 1,6 ****
  124.   /***********************************************************
  125.   
  126. ! $Header: ICCUtils.c,v 3.1 90/04/16 16:39:28 mikew Exp $
  127.   
  128.   Copyright 1989 by Mike Wexler, Santa Clara, Ca.
  129.   
  130. --- 1,6 ----
  131.   /***********************************************************
  132.   
  133. ! $Header: ICCUtils.c,v 3.2 90/05/30 10:41:39 mikew Exp $
  134.   
  135.   Copyright 1989 by Mike Wexler, Santa Clara, Ca.
  136.   
  137. ***************
  138. *** 32,38 ****
  139.   #include "Atoms.h"
  140.   #include "ICC.h"
  141.   #include "ICCUtils.h"
  142. - #include "xdefs.h"
  143.   #include "WinInfo.h"
  144.   #include "State.h"
  145.   
  146. --- 32,37 ----
  147. ***************
  148. *** 94,100 ****
  149.       /* do a zero length append to WM_PROTOCOLS to get a time stamp. */
  150.       XSelectInput(display, window, PropertyChangeMask);
  151.       XChangeProperty(display, window, wmProtocolsAtom, XA_ATOM, 32,
  152. !              PropModeAppend, data, 0);
  153.       for (;;) {
  154.       XtAppNextEvent(myAppContext, &event);
  155.       if (event.type == PropertyNotify && pEvent->window == window &&
  156. --- 93,99 ----
  157.       /* do a zero length append to WM_PROTOCOLS to get a time stamp. */
  158.       XSelectInput(display, window, PropertyChangeMask);
  159.       XChangeProperty(display, window, wmProtocolsAtom, XA_ATOM, 32,
  160. !              PropModeAppend, (unsigned char *) data, 0);
  161.       for (;;) {
  162.       XtAppNextEvent(myAppContext, &event);
  163.       if (event.type == PropertyNotify && pEvent->window == window &&
  164. ***************
  165. *** 119,127 ****
  166.   Window          window;        /* the window to be checked */
  167.   Atom            protocol;    /* protocol to check for */
  168.   {
  169. !     int             i;
  170. !     Atom *protocols;
  171. !     unsigned long numProtocols;
  172.   
  173.       protocols = NULL;
  174.       /* Get the WM_PROTOCOLS property on the clients top-level window. */
  175. --- 118,126 ----
  176.   Window          window;        /* the window to be checked */
  177.   Atom            protocol;    /* protocol to check for */
  178.   {
  179. !     int        i;
  180. !     Atom       *protocols;
  181. !     long    numProtocols;
  182.   
  183.       protocols = NULL;
  184.       /* Get the WM_PROTOCOLS property on the clients top-level window. */
  185. ***************
  186. *** 164,170 ****
  187.       XSelectInput(display, window, PropertyChangeMask);    
  188.   
  189.       if ((cc = XSendEvent(display, window, False, NoEventMask,
  190. !      &saveYourselfMessage)) != 1) {
  191.       Warning("SaveYourself", "XSendEvent failed to send client message.\n");
  192.       return (cc);
  193.       }
  194. --- 163,169 ----
  195.       XSelectInput(display, window, PropertyChangeMask);    
  196.   
  197.       if ((cc = XSendEvent(display, window, False, NoEventMask,
  198. !      (XEvent *) &saveYourselfMessage)) != 1) {
  199.       Warning("SaveYourself", "XSendEvent failed to send client message.\n");
  200.       return (cc);
  201.       }
  202. ***************
  203. *** 183,189 ****
  204.       State          *state;    /* anchor for the list of windows */
  205.   {
  206.       Window          rootWindow, *childList, parentWindow;
  207. !     int             childListLen;
  208.       WinInfo        *wi;
  209.       int             i;
  210.   
  211. --- 182,188 ----
  212.       State          *state;    /* anchor for the list of windows */
  213.   {
  214.       Window          rootWindow, *childList, parentWindow;
  215. !     unsigned int    childListLen;
  216.       WinInfo        *wi;
  217.       int             i;
  218.   
  219. *** R4+/Imakefile    Fri Jun  1 12:38:26 1990
  220. --- ./Imakefile    Fri Jun  1 12:48:01 1990
  221. ***************
  222. *** 1,7 ****
  223.          PROGRAMS = sm
  224.            SM_DIR = $(LIBDIR)/sm
  225.           DEFINES = -DSM_DIR=\"${SM_DIR}\"
  226. !   SYS_LIBRARIES = -lXaw -lXt -lXmu -lX11
  227.             SRCS = Actions.c Atoms.c Globals.c \
  228.                      ICCUtils.c PropUtils.c SM.c \
  229.              StateMisc.c StateGet.c StateExecute.c StateRead.c \
  230. --- 1,7 ----
  231.          PROGRAMS = sm
  232.            SM_DIR = $(LIBDIR)/sm
  233.           DEFINES = -DSM_DIR=\"${SM_DIR}\"
  234. ! LOCAL_LIBRARIES = $(XAWLIB) $(XMULIB) $(XTOOLLIB) $(XLIB)
  235.             SRCS = Actions.c Atoms.c Globals.c \
  236.                      ICCUtils.c PropUtils.c SM.c \
  237.              StateMisc.c StateGet.c StateExecute.c StateRead.c \
  238. *** R4+/Makefile    Fri Jun  1 12:38:27 1990
  239. --- ./Makefile    Wed May 30 12:59:46 1990
  240. ***************
  241. *** 228,234 ****
  242.          PROGRAMS = sm
  243.            SM_DIR = $(LIBDIR)/sm
  244.           DEFINES = -DSM_DIR=\"${SM_DIR}\"
  245. !   SYS_LIBRARIES = -lXaw -lXt -lXmu -lX11
  246.             SRCS = Actions.c Atoms.c Globals.c \
  247.                      ICCUtils.c PropUtils.c SM.c \
  248.              StateMisc.c StateGet.c StateExecute.c StateRead.c \
  249. --- 228,234 ----
  250.          PROGRAMS = sm
  251.            SM_DIR = $(LIBDIR)/sm
  252.           DEFINES = -DSM_DIR=\"${SM_DIR}\"
  253. ! LOCAL_LIBRARIES = $(XAWLIB) $(XMULIB) $(XTOOLLIB) $(XLIB)
  254.             SRCS = Actions.c Atoms.c Globals.c \
  255.                      ICCUtils.c PropUtils.c SM.c \
  256.              StateMisc.c StateGet.c StateExecute.c StateRead.c \
  257. *** R4+/PropUtils.c    Fri Jun  1 12:38:14 1990
  258. --- ./PropUtils.c    Wed May 30 10:39:55 1990
  259. ***************
  260. *** 1,6 ****
  261.   /***********************************************************
  262.   
  263. ! $Header: PropUtils.c,v 3.0 89/11/20 09:25:06 mikew Exp $
  264.   
  265.   Copyright 1989 by Mike Wexler, Santa Clara, Ca.
  266.   
  267. --- 1,6 ----
  268.   /***********************************************************
  269.   
  270. ! $Header: PropUtils.c,v 3.1 90/05/30 10:42:21 mikew Exp $
  271.   
  272.   Copyright 1989 by Mike Wexler, Santa Clara, Ca.
  273.   
  274. ***************
  275. *** 29,36 ****
  276.   #include <X11/Xatom.h>
  277.   #include "X11/Xutil.h"
  278.   #include "ICC.h"
  279. - #include "xdefs.h"
  280. - #include "PropUtils.h"
  281.   #include "Atoms.h"
  282.   
  283.   /*
  284. --- 29,34 ----
  285. ***************
  286. *** 48,54 ****
  287.       unsigned char **windowName;    /* window name(ISO Latin 1) */
  288.       unsigned char **iconName;    /* icon name (ISO Latin 1) */
  289.       Pixmap         *iconPixmap;    /* icon pixmap */
  290. !     unsigned char ***argv;    /* command line argument list */
  291.       int            *argc;    /* number of command line arguments */
  292.       XSizeHints     *hints;    /* WM_NORMAL_HINTS */
  293.       unsigned char **clientMachine;    /* WM_CLIENT_MACHINE */
  294. --- 46,52 ----
  295.       unsigned char **windowName;    /* window name(ISO Latin 1) */
  296.       unsigned char **iconName;    /* icon name (ISO Latin 1) */
  297.       Pixmap         *iconPixmap;    /* icon pixmap */
  298. !     char      ***argv;    /* command line argument list */
  299.       int            *argc;    /* number of command line arguments */
  300.       XSizeHints     *hints;    /* WM_NORMAL_HINTS */
  301.       unsigned char **clientMachine;    /* WM_CLIENT_MACHINE */
  302. ***************
  303. *** 65,71 ****
  304.       else {
  305.       *clientMachine = NULL;
  306.       if (textProperty.value)
  307. !         XFree(textProperty.value);
  308.       }
  309.       XGetWMNormalHints(display, window, hints, &supplied);
  310.       XGetWMName(display, window, &textProperty);
  311. --- 63,69 ----
  312.       else {
  313.       *clientMachine = NULL;
  314.       if (textProperty.value)
  315. !         XFree((char *) textProperty.value);
  316.       }
  317.       XGetWMNormalHints(display, window, hints, &supplied);
  318.       XGetWMName(display, window, &textProperty);
  319. ***************
  320. *** 74,80 ****
  321.       else {
  322.       *windowName = NULL;
  323.       if (textProperty.value)
  324. !         XFree(textProperty.value);
  325.       }
  326.       return (1);
  327.   }
  328. --- 72,78 ----
  329.       else {
  330.       *windowName = NULL;
  331.       if (textProperty.value)
  332. !         XFree((char *) textProperty.value);
  333.       }
  334.       return (1);
  335.   }
  336. *** R4+/SM.ad    Fri Jun  1 12:38:26 1990
  337. --- ./SM.ad    Fri Jun  1 12:48:36 1990
  338. ***************
  339. *** 29,54 ****
  340.       <Btn1Up>:    notify()unset()saveState()\n
  341.   SM.homeForm.saveStateButton.fromHoriz:        quitButton
  342.   
  343. - SM.confirmPopup.geometry:                174x80+500+400
  344.   SM.confirmPopup.confirmForm.borderWidth:        0
  345.   
  346. ! SM.confirmPopup.confirmForm.confirmLabel.label:    Save State?
  347. ! SM.confirmPopup.confirmForm.confirmLabel.borderWidth:    0
  348.   
  349. - SM.confirmPopup.confirmForm.exitYesButton.fromVert:    confirmLabel
  350.   SM.confirmPopup.confirmForm.exitYesButton.label:    Yes
  351.   SM.confirmPopup.confirmForm.exitYesButton.translations:#override \
  352.       <Btn1Up>:    notify()unset()saveState()exit()\n
  353.   
  354. - SM.confirmPopup.confirmForm.exitNoButton.fromHoriz: exitYesButton
  355. - SM.confirmPopup.confirmForm.exitNoButton.fromVert:    confirmLabel
  356.   SM.confirmPopup.confirmForm.exitNoButton.label:    No
  357.   SM.confirmPopup.confirmForm.exitNoButton.translations:#override \
  358.       <Btn1Up>:    notify()unset()exit()\n
  359.   
  360. - SM.confirmPopup.confirmForm.cancelButton.fromHoriz:    exitNoButton
  361. - SM.confirmPopup.confirmForm.cancelButton.fromVert:    confirmLabel
  362.   SM.confirmPopup.confirmForm.cancelButton.label:    Cancel
  363.   SM.confirmPopup.confirmForm.cancelButton.translations:#override \
  364.       <Btn1Up>:    notify()unset()cancel()\n
  365. --- 29,46 ----
  366.       <Btn1Up>:    notify()unset()saveState()\n
  367.   SM.homeForm.saveStateButton.fromHoriz:        quitButton
  368.   
  369.   SM.confirmPopup.confirmForm.borderWidth:        0
  370.   
  371. ! SM.confirmPopup.confirmForm*label:    Save State?
  372.   
  373.   SM.confirmPopup.confirmForm.exitYesButton.label:    Yes
  374.   SM.confirmPopup.confirmForm.exitYesButton.translations:#override \
  375.       <Btn1Up>:    notify()unset()saveState()exit()\n
  376.   
  377.   SM.confirmPopup.confirmForm.exitNoButton.label:    No
  378.   SM.confirmPopup.confirmForm.exitNoButton.translations:#override \
  379.       <Btn1Up>:    notify()unset()exit()\n
  380.   
  381.   SM.confirmPopup.confirmForm.cancelButton.label:    Cancel
  382.   SM.confirmPopup.confirmForm.cancelButton.translations:#override \
  383.       <Btn1Up>:    notify()unset()cancel()\n
  384. *** R4+/SM.h    Fri Jun  1 12:38:15 1990
  385. --- ./SM.h    Wed May 30 12:01:56 1990
  386. ***************
  387. *** 1,6 ****
  388.   /***********************************************************
  389.   
  390. ! $Header: SM.h,v 3.1 90/04/16 17:20:59 mikew Exp $
  391.   
  392.   Copyright 1989 by Mike Wexler, Santa Clara, Ca.
  393.   
  394. --- 1,6 ----
  395.   /***********************************************************
  396.   
  397. ! $Header: SM.h,v 3.4 90/05/30 12:04:22 mikew Exp $
  398.   
  399.   Copyright 1989 by Mike Wexler, Santa Clara, Ca.
  400.   
  401. ***************
  402. *** 56,59 ****
  403. --- 56,61 ----
  404.   extern void     Warning();
  405.   extern void     PWarning();
  406.   extern void     Usage();
  407. + #if !defined(__STDC__) && !defined(sgi)
  408.   extern char    *strdup();
  409. + #endif
  410. *** R4+/StateGet.c    Fri Jun  1 12:38:17 1990
  411. --- ./StateGet.c    Wed May 30 10:41:44 1990
  412. ***************
  413. *** 1,6 ****
  414.   /***********************************************************
  415.   
  416. ! $Header: StateGet.c,v 3.1 90/04/16 17:19:06 mikew Exp $
  417.   
  418.   Copyright 1989 by Mike Wexler, Santa Clara, Ca.
  419.   
  420. --- 1,6 ----
  421.   /***********************************************************
  422.   
  423. ! $Header: StateGet.c,v 3.3 90/05/30 10:44:14 mikew Exp $
  424.   
  425.   Copyright 1989 by Mike Wexler, Santa Clara, Ca.
  426.   
  427. ***************
  428. *** 31,39 ****
  429.   #include <X11/Xutil.h>
  430.   #include <X11/Xatom.h>
  431.   
  432. - #include "xdefs.h"
  433.   #include "Top.h"
  434. - #include "PropUtils.h"
  435.   #include "ICCUtils.h"
  436.   #include "WinInfo.h"
  437.   #include "State.h"
  438. --- 31,37 ----
  439. ***************
  440. *** 122,128 ****
  441.       if (event.type == PropertyNotify && pEvent->atom == XA_WM_COMMAND) {
  442.           wi = StateGetWinInfoByRid(state, pEvent->window);
  443.           if (wi && wi->saveYourselfState == Saving) {
  444. !         if (XGetCommand(display, wi->rid, &wi->argv, &wi->argc) != 1) {
  445.               StateRemoveWinInfo(state, wi);
  446.               wiFree(wi);
  447.           }
  448. --- 120,127 ----
  449.       if (event.type == PropertyNotify && pEvent->atom == XA_WM_COMMAND) {
  450.           wi = StateGetWinInfoByRid(state, pEvent->window);
  451.           if (wi && wi->saveYourselfState == Saving) {
  452. !         if (XGetCommand(display, wi->rid, (char ***) &wi->argv, 
  453. !                 &wi->argc) != 1) {
  454.               StateRemoveWinInfo(state, wi);
  455.               wiFree(wi);
  456.           }
  457. ***************
  458. *** 130,138 ****
  459.             wi->saveYourselfState = Saved;
  460.           state->waitForCount--;
  461.           }
  462.       }
  463.       XtDispatchEvent(&event);
  464. -     XSelectInput(display, wi->rid, NoEventMask);
  465.       }
  466.       return (SM_SUCCESS);
  467.   }
  468. --- 129,137 ----
  469.             wi->saveYourselfState = Saved;
  470.           state->waitForCount--;
  471.           }
  472. +         XSelectInput(display, wi->rid, NoEventMask);
  473.       }
  474.       XtDispatchEvent(&event);
  475.       }
  476.       return (SM_SUCCESS);
  477.   }
  478. ***************
  479. *** 223,235 ****
  480.       XGetWindowAttributes(display, wi->rid, &attr);
  481.       XGetWindowAttributes(display, wi->parentRid, &parentAttr);
  482.       if (XGetStandardProperties(display, wi->rid, &wmName, &wmIconName,
  483. !                    &iconPixmap, &wi->argc, &wi->argv,
  484.                  &wmNormalHints, &wi->wmClientMachine) != 1)
  485.       return (SM_FAILURE);
  486.       ComputeGeometry(&attr, &parentAttr, &wmNormalHints, 
  487.               &wi->x, &wi->y, &wi->height, &wi->width);
  488.       if (wmIconName) 
  489. !     XFree(wmIconName);
  490.       /* If the guy doesn't have a WM_COMMAND property, we can't restart him. */
  491.       if (!wi->argv != NULL || !wi->argv[0]) {
  492.       if (!wmName)
  493. --- 222,234 ----
  494.       XGetWindowAttributes(display, wi->rid, &attr);
  495.       XGetWindowAttributes(display, wi->parentRid, &parentAttr);
  496.       if (XGetStandardProperties(display, wi->rid, &wmName, &wmIconName,
  497. !                    &iconPixmap, &wi->argc, (char ***) &wi->argv,
  498.                  &wmNormalHints, &wi->wmClientMachine) != 1)
  499.       return (SM_FAILURE);
  500.       ComputeGeometry(&attr, &parentAttr, &wmNormalHints, 
  501.               &wi->x, &wi->y, &wi->height, &wi->width);
  502.       if (wmIconName) 
  503. !     XFree((char *) wmIconName);
  504.       /* If the guy doesn't have a WM_COMMAND property, we can't restart him. */
  505.       if (!wi->argv != NULL || !wi->argv[0]) {
  506.       if (!wmName)
  507. ***************
  508. *** 239,245 ****
  509.       wi->argc = 1;
  510.       }
  511.       if (wmName)
  512. !     XFree(wmName);
  513.       (void) XGetClassHint(display, wi->rid, &wi->wmClass);
  514.       if ( XGetWMState(display, wi->rid, &wi->wmState) != 1)
  515.       return (SM_FAILURE);
  516. --- 238,244 ----
  517.       wi->argc = 1;
  518.       }
  519.       if (wmName)
  520. !     XFree((char *) wmName);
  521.       (void) XGetClassHint(display, wi->rid, &wi->wmClass);
  522.       if ( XGetWMState(display, wi->rid, &wi->wmState) != 1)
  523.       return (SM_FAILURE);
  524. *** R4+/StateRead.c    Fri Jun  1 12:38:23 1990
  525. --- ./StateRead.c    Fri Jun  1 12:47:00 1990
  526. ***************
  527. *** 1,6 ****
  528.   /***********************************************************
  529.   
  530. ! $Header: StateRead.c,v 1.1 90/04/16 17:20:22 mikew Exp $
  531.   
  532.   Copyright 1989 by Mike Wexler, Santa Clara, Ca.
  533.   
  534. --- 1,6 ----
  535.   /***********************************************************
  536.   
  537. ! $Header: StateRead.c,v 1.2 90/06/01 12:49:30 mikew Exp $
  538.   
  539.   Copyright 1989 by Mike Wexler, Santa Clara, Ca.
  540.   
  541. ***************
  542. *** 126,132 ****
  543.       }
  544.    done:
  545.       *p = 0;
  546. !     *result = (unsigned char *) XtMalloc(p - temp + 1);
  547.       strcpy(*result, temp);
  548.       return(cc);
  549.   }
  550. --- 126,132 ----
  551.       }
  552.    done:
  553.       *p = 0;
  554. !     *result = (unsigned char *) XtMalloc((char *) (p - temp + 1));
  555.       strcpy(*result, temp);
  556.       return(cc);
  557.   }
  558. ***************
  559. *** 285,292 ****
  560. --- 285,294 ----
  561.   char *file;
  562.   {
  563.       struct passwd  *pw;
  564. + #ifndef FUNCPROTO
  565.       int             endpwent();
  566.       struct passwd  *getpwuid();
  567. + #endif
  568.       char           *home;
  569.       static char     path[256];
  570.   
  571. *** R4+/StateSave.c    Fri Jun  1 12:38:19 1990
  572. --- ./StateSave.c    Fri Jun  1 12:47:17 1990
  573. ***************
  574. *** 1,6 ****
  575.   /***********************************************************
  576.   
  577. ! $Header: StateSave.c,v 3.1 90/04/16 17:20:04 mikew Exp $
  578.   
  579.   Copyright 1989 by Mike Wexler, Santa Clara, Ca.
  580.   
  581. --- 1,6 ----
  582.   /***********************************************************
  583.   
  584. ! $Header: StateSave.c,v 3.2 90/06/01 12:49:49 mikew Exp $
  585.   
  586.   Copyright 1989 by Mike Wexler, Santa Clara, Ca.
  587.   
  588. ***************
  589. *** 31,39 ****
  590.   #include <X11/Xutil.h>
  591.   #include <X11/Xatom.h>
  592.   
  593. - #include "xdefs.h"
  594.   #include "Top.h"
  595. - #include "PropUtils.h"
  596.   #include "ICCUtils.h"
  597.   #include "WinInfo.h"
  598.   #include "State.h"
  599. --- 31,37 ----
  600. *** R4+/TODO    Fri Jun  1 12:38:08 1990
  601. --- ./TODO    Fri Jun  1 10:29:52 1990
  602. ***************
  603. *** 1,3 ****
  604. --- 1,5 ----
  605. + 0. Create a NullString define that is defined as ((char *) 0)
  606.   1. Create a better way of starting remote clients.
  607.   [If anyone has any idea or code on how to start clients on a remote machine
  608.   that is portable, please let me know. -mcw]
  609. ***************
  610. *** 35,37 ****
  611. --- 37,43 ----
  612.       was started by sm.
  613.   
  614.   14. Implement a display state function that displays the current state.
  615. + 15. Add a resource to control the default path on the remote machine. This
  616. +     is very important for people who use sh and its derivatives since these
  617. +     shells won't set the path automatically when rsh is executed.
  618. *** R4+/Top.c    Fri Jun  1 12:38:19 1990
  619. --- ./Top.c    Wed May 30 10:41:11 1990
  620. ***************
  621. *** 1,6 ****
  622.   /***********************************************************
  623.   
  624. ! $Header: Top.c,v 3.1 90/04/16 17:20:44 mikew Exp $
  625.   
  626.   Copyright 1989 by Mike Wexler, Santa Clara, Ca.
  627.   
  628. --- 1,6 ----
  629.   /***********************************************************
  630.   
  631. ! $Header: Top.c,v 3.2 90/05/30 10:43:36 mikew Exp $
  632.   
  633.   Copyright 1989 by Mike Wexler, Santa Clara, Ca.
  634.   
  635. ***************
  636. *** 30,36 ****
  637.   #include <X11/Shell.h>
  638.   #include <X11/Xaw/Command.h>
  639.   #include <X11/Xaw/Form.h>
  640. ! #include <X11/Vendor.h>
  641.   
  642.   #include "ICC.h"
  643.   #include "Top.h"
  644. --- 30,36 ----
  645.   #include <X11/Shell.h>
  646.   #include <X11/Xaw/Command.h>
  647.   #include <X11/Xaw/Form.h>
  648. ! #include <X11/Xaw/Dialog.h>
  649.   
  650.   #include "ICC.h"
  651.   #include "Top.h"
  652. ***************
  653. *** 72,77 ****
  654. --- 72,86 ----
  655.        XtOffset(ApplicationDataPtr, metaChars), XtRString, "*#\"\\"},
  656.   };
  657.   
  658. + static char *fallbackResources[] = {
  659. +  "SM.homeForm.quitButton.translations:    #override \\n   <Btn1Up>: exit()",
  660. +  "SM.homeForm.quitButton.Label:                 Quit",
  661. +  "SM.homeForm.saveStateButton.sensitive:        FALSE",
  662. +  "SM.homeForm.saveStateButton.fromHoriz:        quitButton",
  663. +  "SM.homeForm.saveStateButton.Label:            No app-defaults file found",
  664. +  NULL,
  665. + };
  666.   /*
  667.    * Description: Create the top-level widgets.
  668.    * 
  669. ***************
  670. *** 110,119 ****
  671.       Widget          exitNoButton;
  672.       Widget          cancelButton;
  673.   
  674. !     confirmPopup = XtCreatePopupShell("confirmPopup", vendorShellWidgetClass,
  675.                         parent, NULL, 0);
  676.   
  677. !     confirmForm = XtCreateManagedWidget("confirmForm", formWidgetClass, 
  678.                       confirmPopup,
  679.                       NULL, 0);
  680.   
  681. --- 119,129 ----
  682.       Widget          exitNoButton;
  683.       Widget          cancelButton;
  684.   
  685. !     confirmPopup = XtCreatePopupShell("confirmPopup", 
  686. !                       transientShellWidgetClass,
  687.                         parent, NULL, 0);
  688.   
  689. !     confirmForm = XtCreateManagedWidget("confirmForm", dialogWidgetClass, 
  690.                       confirmPopup,
  691.                       NULL, 0);
  692.   
  693. ***************
  694. *** 153,159 ****
  695.       n = 0;
  696.       topShell = XtAppInitialize(&myAppContext, "SM",
  697.                      options, XtNumber(options), 
  698. !                    &argc, argv, NULL, args, n);
  699.       if (argc != 1)
  700.       Usage();
  701.       XtGetApplicationResources(topShell, (XtPointer) &applData, tsResources,
  702. --- 163,169 ----
  703.       n = 0;
  704.       topShell = XtAppInitialize(&myAppContext, "SM",
  705.                      options, XtNumber(options), 
  706. !                    &argc, argv, fallbackResources, args, n);
  707.       if (argc != 1)
  708.       Usage();
  709.       XtGetApplicationResources(topShell, (XtPointer) &applData, tsResources,
  710. *** R4+/Utils.c    Fri Jun  1 12:38:20 1990
  711. --- ./Utils.c    Wed May 30 12:01:24 1990
  712. ***************
  713. *** 1,6 ****
  714.   /***********************************************************
  715.   
  716. ! $Header: Utils.c,v 3.1 90/04/16 17:20:41 mikew Exp $
  717.   
  718.   Copyright 1989 by Mike Wexler, Santa Clara, Ca.
  719.   
  720. --- 1,6 ----
  721.   /***********************************************************
  722.   
  723. ! $Header: Utils.c,v 3.2 90/05/30 12:03:52 mikew Exp $
  724.   
  725.   Copyright 1989 by Mike Wexler, Santa Clara, Ca.
  726.   
  727. ***************
  728. *** 100,102 ****
  729. --- 100,116 ----
  730.       return(SM_SUCCESS);
  731.   }
  732.   
  733. + #if !defined(__STDC__) && !defined(sgi)
  734. + char *
  735. + strdup(str)
  736. + char    *str;
  737. + {
  738. +     char *dup;
  739. +     dup = malloc(strlen(str) + 1);
  740. +     if (dup == NULL)
  741. +     return (NULL);
  742. +     strcpy(dup, str);
  743. +     return(dup);
  744. + }
  745. + #endif
  746. *** R4+/WinInfo.c    Fri Jun  1 12:38:21 1990
  747. --- ./WinInfo.c    Wed May 30 13:00:50 1990
  748. ***************
  749. *** 1,6 ****
  750.   /***********************************************************
  751.   
  752. ! $Header: WinInfo.c,v 3.0 89/11/20 09:25:45 mikew Exp $
  753.   
  754.   Copyright 1989 by Mike Wexler, Santa Clara, Ca.
  755.   and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
  756. --- 1,6 ----
  757.   /***********************************************************
  758.   
  759. ! $Header: WinInfo.c,v 3.1 90/05/30 13:03:15 mikew Exp $
  760.   
  761.   Copyright 1989 by Mike Wexler, Santa Clara, Ca.
  762.   and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
  763. ***************
  764. *** 64,70 ****
  765.   wiFree(winInfo)
  766.       WinInfoPtr        winInfo;    /* pointer to the WinInfo structure to free */
  767.   {
  768. !     XtFree(winInfo);
  769.       return (SM_SUCCESS);
  770.   }
  771.   
  772. --- 64,70 ----
  773.   wiFree(winInfo)
  774.       WinInfoPtr        winInfo;    /* pointer to the WinInfo structure to free */
  775.   {
  776. !     XtFree((char *) winInfo);
  777.       return (SM_SUCCESS);
  778.   }
  779.   
  780. *** R4+/osdefs.h    Fri Jun  1 12:38:25 1990
  781. --- ./osdefs.h    Wed May 30 10:40:39 1990
  782. ***************
  783. *** 1,6 ****
  784.   /***********************************************************
  785.   
  786. ! $Header: osdefs.h,v 3.0 89/11/20 09:25:48 mikew Exp $
  787.   
  788.   Copyright 1989 by Mike Wexler, Santa Clara, Ca.
  789.   
  790. --- 1,6 ----
  791.   /***********************************************************
  792.   
  793. ! $Header: osdefs.h,v 3.2 90/05/30 10:43:00 mikew Exp $
  794.   
  795.   Copyright 1989 by Mike Wexler, Santa Clara, Ca.
  796.   
  797. ***************
  798. *** 24,36 ****
  799.   
  800.   ******************************************************************/
  801.   
  802. ! extern int      exit();
  803. ! extern int      fprintf();
  804.   extern char    *sprintf();
  805. - extern int      perror();
  806. - extern int      gethostname();
  807. - extern int      fclose();
  808. - extern int      getuid();
  809.   extern char    *getenv();
  810. ! extern int      access();
  811. ! extern int      system();
  812. --- 24,30 ----
  813.   
  814.   ******************************************************************/
  815.   
  816. ! #ifndef FUNCPROTO
  817.   extern char    *sprintf();
  818.   extern char    *getenv();
  819. ! #endif
  820.  
  821. dan
  822. ----------------------------------------------------
  823. O'Reilly && Associates   argv@sun.com / argv@ora.com
  824. Opinions expressed reflect those of the author only.
  825.